package com.dbappsecurity.bifrost.di.module;

import android.app.Activity;
import android.support.v4.app.FragmentManager;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import com.dbappsecurity.bifrost.contract.BaseContract;
import com.dbappsecurity.bifrost.di.scope.ActivityScope;
import com.dbappsecurity.core.CoreBaseActivity;
import com.tbruyelle.rxpermissions2.RxPermissions;
import dagger.Module;
import dagger.Provides;
import io.reactivex.disposables.CompositeDisposable;

/**
 * Created by codeest on 16/8/7.
 */

@Module
public class ActivityModule {
    private CoreBaseActivity mActivity;

    public ActivityModule(CoreBaseActivity activity) {
        this.mActivity = activity;
    }

    @Provides
    @ActivityScope
    public RxPermissions provideRxPermission() {
        return new RxPermissions(mActivity);
    }

    @Provides
    @ActivityScope
    public FragmentManager getFragmentMgr() {
        return mActivity.getSupportFragmentManager();
    }

    @Provides
    @ActivityScope
    public Unbinder getViewBinder() {
        return ButterKnife.bind(mActivity);
    }

    @Provides
    @ActivityScope
    public CompositeDisposable getDisposables() {
        return new CompositeDisposable();
    }


    @Provides
    @ActivityScope
    public StringBuilder getStringBuilder() {
        return new StringBuilder();
    }

}
